package com.javacode2018.lesson001.demo14;

import com.sun.org.apache.bcel.internal.classfile.Code;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Author: hongsir
 * @Date: 2024/10/11 - 10 - 11 - 9:44
 * @Description: com.javacode2018.lesson001.demo14
 * @Version: 1.0
 */
public class ReplacedMethodTest {

    @Test
    public void replacedmethod() {
        String beanXml = "classpath:/com/javacode2018/lesson001/demo14/replacedmethod.xml";
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(beanXml);

        System.out.println(context.getBean(ServiceA.class)); //@1
        System.out.println(context.getBean(ServiceA.class)); //@2

        System.out.println("serviceB中的serviceA");
        ServiceB serviceB = context.getBean(ServiceB.class); //@3
        serviceB.say();
        serviceB.say();
    }
}
